# /etc/profile

# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc

# It's NOT a good idea to change this file unless you know what you
# are doing. It's much better to create a custom.sh shell script in
# /etc/profile.d/ to make custom changes to your environment, as this
# will prevent the need for merging in future updates.

pathmunge () {
    case ":${PATH}:" in
        *:"$1":*)
            ;;
        *)
            if [ "$2" = "after" ] ; then
                PATH=$PATH:$1
            else
                PATH=$1:$PATH
            fi
    esac
}


if [ -x /usr/bin/id ]; then
    if [ -z "$EUID" ]; then
        # ksh workaround
        EUID=`/usr/bin/id -u`
        UID=`/usr/bin/id -ru`
    fi
    USER="`/usr/bin/id -un`"
    LOGNAME=$USER
    MAIL="/var/spool/mail/$USER"
fi

# Path manipulation
if [ "$EUID" = "0" ]; then
    pathmunge /sbin
    pathmunge /usr/sbin
    pathmunge /usr/local/sbin
else
    pathmunge /usr/local/sbin after
    pathmunge /usr/sbin after
    pathmunge /sbin after
fi

HOSTNAME=`/bin/hostname 2>/dev/null`
HISTSIZE=1000
if [ "$HISTCONTROL" = "ignorespace" ] ; then
    export HISTCONTROL=ignoreboth
else
    export HISTCONTROL=ignoredups
fi

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL

# By default, we want umask to get set. This sets it for login shell
# Current threshold for system reserved uid/gids is 200
# You could check uidgid reservation validity in
# /usr/share/doc/setup-*/uidgid file
if [ $UID -gt 199 ] && [ "`/usr/bin/id -gn`" = "`/usr/bin/id -un`" ]; then
    umask 002
else
    umask 022
fi

for i in /etc/profile.d/*.sh ; do
    if [ -r "$i" ]; then
        if [ "${-#*i}" != "$-" ]; then
            . "$i"
        else
            . "$i" >/dev/null 2>&1
        fi
    fi
done

unset i
unset -f pathmunge

export RZSZ_HOME=/export/servers/lrzsz-0.12.20
export PATH=$RZSZ_HOME/bin:$PATH

export JAVA_HOME=/export/servers/jdk1.8.0_141
export PATH=$JAVA_HOME/bin:$PATH

export ZK_HOME=/export/servers/zookeeper-3.4.5-cdh5.14.0
export PATH=$ZK_HOME/bin:$PATH

export HADOOP_HOME=/export/servers/hadoop-2.6.0-cdh5.14.0
export PATH=$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$PATH
export HADOOP_CONF_DIR=/export/servers/hadoop-2.6.0-cdh5.14.0/etc/hadoop

export SCALA_HOME=/export/servers/scala-2.11.8
export PATH=$SCALA_HOME/bin:$PATH

export SPARK_HOME=/export/servers/spark-2.2.0-bin-hadoop2.6
export PATH=$SPARK_HOME/bin:$SPARK_HOME/sbin:$PATH

#export HIVE_HOME=/export/servers/hive-1.1.0-cdh5.14.0
#export PATH=$HIVE_HOME:$PATH

export ONEKEY_HOME=/export/servers/onekey
export PATH=$ONEKEY_HOME/zookeeper:$PATH
export PATH=$ONEKEY_HOME/storm:$PATH
export PATH=$ONEKEY_HOME/cluster:$PATH
export PATH=$ONEKEY_HOME/druid:$PATH

export KAFKA_HOME=/export/servers/kafka_2.11-1.0.0
#export KAFKA_HOME=/export/servers/kafka_2.11-0.10.1.0
export PATH=$KAFKA_HOME/bin:$PATH

export HBASE_HOME=/export/servers/hbase-1.1.1
export PATH=$HBASE_HOME/bin:$PATH

export STORM_HOME=/export/servers/apache-storm-1.1.1
export PATH=$STORM_HOME/bin:$PATH

#canal
export CANAL_HOME=/export/servers/canal
export PATH=$CANAL_HOME/bin:$PATH

# DRUID
export DRUID_HOME=/export/servers/imply-3.0.4
export PATH=$DRUID_HOME/bin:$PATH
